#pragma once
#include <map>
#include "EpilReferenceObject.h"

using namespace std;


typedef map<EpilObject*, EpilObject*>	EpilObjectMap;


class EpilTableObject : public EpilReferenceObject
{
	EPIL_OBJECT_DECL( Table );

public:
	EpilTableObject( EpilInterpreter * interpreter );
	virtual ~EpilTableObject();

	EpilObjectMap &						GetFields()										{ return m_fields; }
	const EpilObjectMap &				GetFields() const								{ return m_fields; }

	EpilObject *						GetField( const EpilObject * key ) const;

	EpilObject *						GetField( bool key ) const;
	EpilObject *						GetField( int key ) const;
	EpilObject *						GetField( double key ) const;
	EpilObject *						GetField( const tstring & key ) const;

	void								SetField( EpilObject * key, EpilObject * value );

	void								SetField( bool key, EpilObject * value );
	void								SetField( int key, EpilObject * value );
	void								SetField( double key, EpilObject * value );
	void								SetField( const tstring & key, EpilObject * value );

	EpilObject *						OperateUnary( EpilUnaryOperator op );
	EpilObject *						OperateBinary( EpilBinaryOperator op, EpilObject * that );

	virtual tstring						ToString() const;

private:
	EpilObjectMap						m_fields;
};
